<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
<title>功能管理</title>
<style type="text/css">
html,body {
	margin: 0;
	padding: 0;
	border: 0;
	width: 100%;
	height: 100%;
}
.function-item 
    {
        margin-left:5px;
        margin-right:5px;
    }
    .function-item input
    {
        vertical-align:bottom;
    }
</style>
<script src="../scripts/boot.js" type="text/javascript"></script>
</head>

<body>
	<div class="mini-fit">
		<div class="mini-panel" title="header" iconCls="icon-add"
			borderStyle="border:0px" style="width:100%;height:100%;"
			showHeader="false" showToolbar="false" showCloseButton="false"
			showFooter="true">
			<!--footer-->
			<div property="footer" style="text-align:center;padding:5px">
				<a class="mini-button" iconCls="icon-new" onclick="save">保存</a>
				&nbsp;&nbsp; <a class="mini-button" iconCls="icon-remove"
					onclick="closeWindow()">取消</a>
			</div>
			<div id="form1">
				<div id="treegrid1" class="mini-treegrid"
					style="width:100%;height:100%;"
					url="moduleRoleData?roleId=${roleId}"
					treeColumn="name" idField="id" parentField="fid"
					resultAsTree="false" allowResize="false" expandOnLoad="true"
					 showCheckBox="true" checkRecursive="false"
					showTreeIcon="false" allowSelect="true" allowCellSelect="false"
					enableHotTrack="true" allowCellWrap="true">
					<div property="columns">
						<div type="indexcolumn"></div>
						<div name="name" field="name" width="150">模块名称</div>
					</div>
				</div>
			</div>
		</div>
	</div>

<script type="text/javascript">
	var roleId = ${roleId};
	mini.parse();
	var tree = mini.get("treegrid1");
	//tree.load();
	var showAllSelect = true;
	function save() {
		var data = tree.getValue(true);
		$.ajax({
			url : "updateModuleRole",
			type : "post",
			data : {roleId:roleId,data:data},
			cache : false,
			success : function(text) {
				var result = mini.decode(text);
				if (result.res) {
					mini.alert(result.msg, "提示", function() {
						closeWindow("save");
					});
				} else {
					mini.alert(result.msg, "提示");
				}
			},
			error : function(jqXHR, textStatus, errorThrown) {
				alert(jqXHR.responseText);
			}
		});
	}

	function closeWindow(action) {
		if (window.CloseOwnerWindow)
			return window.CloseOwnerWindow(action);
		else
			window.close();
	}
	function cancel(e) {
		closeWindow(e);
	}
</script>
</body>
</html>
